<?php
/**
 * Account_Controller_Admin
 *  
 * Controller for actions (in admin area) of admin module
 *
 * @version 2012-10-10
 * @package account
 * @subpackage controller
 * @category Account_Controller_Admin
 */
 
 class Pages_Controller_Visitor extends Controller
{

	/** 
	* Index
	* Default function that will be used upon module start-up.
    *
    * @version 2012-10-10
    * @param Request $req
    * @return view
    * @access public
    */
    public function processIndex($req)
    {
		return $this->processPage($req);
    }
	
	
    public function processPage($req){
		$dbPages = Db::getModel('pages');
		$result = array();
		$book_id = $req->getInt('bid',1);
		$page_id = $req->getInt('pid',1);

		$pages = $dbPages->getPage($book_id,$page_id);
		$result['page'] = $pages['text'];
		$result['pager'] = array('current'=>$pages['num_page'],'totalPages'=>$pages['cnt_page']);
		echo json_encode($result);
       exit;
    }
}
